<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group(['prefix' => 'admin', 'namespace' => 'Web'], function () {
    Route::get('/login', ['as' => 'login', 'uses' => 'LoginController@login']);
    Route::post('/login-submit', ['as' => 'login-submit', 'uses' => 'LoginController@loginSubmit']);
    Route::get('/logout', ['as' => 'logout', 'uses' => 'LoginController@logout']);
    Route::group(['middleware' => 'admin.auth'], function () {
        Route::get('/', 'IndexController@index')->name('home');

        //订单列表
        Route::get('/order/wait_receive', 'OrderController@waitReceive')->name('order.wait_receive');    //待接单
        Route::get('/order/distribution', 'OrderController@distribution')->name('order.distribution');   //配送中
        Route::get('/order/finish', 'OrderController@finish')->name('order.finish');   //配送中
        Route::get('/order/all', 'OrderController@all')->name('order.all');   //所有
        Route::get('/order/detail', 'OrderController@detail')->name('order.detail');   //订单详情
        Route::get('/order/ticket', 'OrderController@ticket')->name('order.ticket');   //票务订单列表
        Route::post('/order/remark', 'OrderController@remark')->name('order.remark');   //订单备注

        //提现列表
        Route::get('/cash_apply/list', 'CashApplyController@list')->name('cash_apply.list');

        //镖师
        Route::get('/escort/data_list', 'EscortController@data_list')->name('escort.data_list');
        Route::get('/escort/apply_list', 'EscortController@applyList')->name('escort.apply_list');
        Route::get('/escort/list', 'EscortController@escortList')->name('escort.list');
        Route::get('/escort/add', 'EscortController@escortAdd')->name('escort.add');
        Route::get('/escort/change', 'EscortController@change')->name('escort.change');
        Route::post('/escort/set_leader', 'EscortController@setLeader')->name('escort.set_leader');
        Route::post('/escort/be_leader', 'EscortController@beLeader')->name('escort.be_leader');
        Route::post('/escort/cancel_leader', 'EscortController@cancelLeader')->name('escort.cancel_leader');
        Route::post('/escort/set_escort_schools', 'EscortController@set_escort_schools')->name('escort.set_escort_schools');
        Route::delete('/escort/destroy', 'EscortController@destroy')->name('escort.destroy');
        Route::get('/escort/show_chart', 'EscortController@show_chart')->name('escort.show_chart');
        Route::get('/escort/orderchart', 'EscortController@orderchart')->name('escort.orderchart');

        //余额
        Route::get('/balance/recharge_record', 'BalanceController@rechargeRecord')->name('balance.recharge_record');
        Route::get('/balance/detail', 'BalanceController@detail')->name('balance.detail');
        Route::get('/balance/withdraw_apply', 'BalanceController@withdrawApply')->name('balance.withdraw_apply');
        Route::post('/balance/withdraw_apply/check', 'BalanceController@withdrawApplyCheck')->name('balance.withdraw_apply.check');

        //用户
        Route::get('/user/search', 'UserController@searchUser')->name('user.search');

        Route::get('/user/list', 'UserController@userList')->name('user.list');
        Route::post('/user/be_leader', 'UserController@beLeader')->name('user.be_leader');
        Route::post('/user/cancel_leader', 'UserController@cancelLeader')->name('user.cancel_leader');

        Route::resource('school', 'SchoolController', ['except' => ['show']]);
        Route::get('/school/search', 'SchoolController@searchSchool')->name('school.search');
        Route::get('/school/area', 'SchoolController@area')->name('school.area');
        Route::resource('shop', 'ShopController', ['except' => ['show']]);
    });
});


Route::get('/', function(){
    return redirect('/admin');
});
